﻿//-----------------------------------------------------------------------
// <copyright file="MLTempObjectData.cs" company="MAPILab Ltd">
//     Copyright (c) MAPILab Ltd.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace MAPILab.SharePoint.Explorer.ObjectBrowser.TreeExpand
{
    using System;

    #region enums

    /// <summary>
    /// 
    /// </summary>
    public enum ImageType
    {
        /// <summary>
        /// 
        /// </summary>
        Class = 0,

        /// <summary>
        /// 
        /// </summary>
        Property = 1,

        /// <summary>
        /// 
        /// </summary>
        Field = 2,

        /// <summary>
        /// 
        /// </summary>
        Method = 3,

        /// <summary>
        /// 
        /// </summary>
        SPPersistedObject = 4,

        /// <summary>
        /// 
        /// </summary>
        Interface = 5
    }

    #endregion

    /// <summary>
    /// 
    /// </summary>
    public class MLTempObjectData : IComparable<MLTempObjectData>
    {
        #region Fields

        /// <summary>
        /// Is root
        /// </summary>
        private bool root;

        /// <summary>
        /// tree node name
        /// </summary>
        private string name;

        /// <summary>
        /// tree node object
        /// </summary>
        private object nodeObject;

        /// <summary>
        /// tree node object type
        /// </summary>
        private Type objectDeclatingType;

        /// <summary>
        /// Is public
        /// </summary>
        private bool publicProp;

        /// <summary>
        /// Image index
        /// </summary>
        private ImageType imageIndex;

        /// <summary>
        /// Has persisted object role
        /// </summary>
        private bool persistedObjectRole;

        #endregion

        #region Properties

        /// <summary>
        /// Gets and sets is root
        /// </summary>
        public bool Root
        {
            get { return this.root; }
            set { this.root = value; }
        }

        /// <summary>
        /// Gets and sets object name
        /// </summary>
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }

        /// <summary>
        /// Gets and sets tree node object
        /// </summary>
        public object NodeObject
        {
            get { return this.nodeObject; }
            set { this.nodeObject = value; }
        }

        /// <summary>
        /// Gets and sets tree node object type
        /// </summary>
        public Type ObjectDeclatingType
        {
            get { return this.objectDeclatingType; }
            set { this.objectDeclatingType = value; }
        }

        /// <summary>
        /// Gets and sets is public
        /// </summary>
        public bool PublicProp
        {
            get { return this.publicProp; }
            set { this.publicProp = value; }
        }
        
        /// <summary>
        /// Gets and sets image index
        /// </summary>
        public ImageType ImageIndex
        {
            get { return this.imageIndex; }
            set { this.imageIndex = value; }
        }

        /// <summary>
        /// Gets and sets has persisted object role
        /// </summary>
        public bool PersistedObjectRole
        {
            get { return this.persistedObjectRole; }
            set { this.persistedObjectRole = value; }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// Default constructor
        /// </summary>
        public MLTempObjectData() { }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="root">Is root</param>
        /// <param name="name">Node name</param>
        /// <param name="nodeObject">Tree node object type</param>
        /// <param name="objectDeclatingType">Is public</param>
        /// <param name="publicProp">Image index</param>
        /// <param name="imageIndex">Has persisted object role</param>
        /// <param name="persistedObjectRole"></param>
        public MLTempObjectData(bool root, string name, object nodeObject, Type objectDeclatingType, bool publicProp, ImageType imageIndex, bool persistedObjectRole):this()
        {
            this.root = root;
            this.name = name;
            this.nodeObject = nodeObject;
            this.objectDeclatingType = objectDeclatingType;
            this.publicProp = publicProp;
            this.imageIndex = imageIndex;
            this.persistedObjectRole = persistedObjectRole;
        }

        #endregion

        #region IComparable<TempObjectData> Members

        /// <summary>
        /// CompareTo function
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo(MLTempObjectData other)
        {
            return name.CompareTo(other.name);
        }

        #endregion
    }
}
